#include <stdio.h>
#include <stdlib.h>

#define SIZE 9

void swap(int, int *, int);

int main(int argc, const char *argv[])
{
     int arr[SIZE] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
     int p = 0, q = SIZE - 1;
     int tmp;
     while (p < q)
     {
          swap(p, arr, q);
          p++;
          q--;
     }
     for (int i = 0; i < SIZE; i++)
          printf("%d     ", arr[i]);
     printf("\n");
     return 0;
}

void swap(int p, int *arr, int q)
{
     int tmp = arr[p];
     arr[p] = arr[q];
     arr[q] = tmp;
}